local sk__xiejia = fk.CreateSkill {

  name = "sk__xiejia",

  tags = { Skill.Compulsory, },

}



sk__xiejia:addEffect(fk.DamageCaused, {
  name = "sk__xiejia",
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target and target == player and player:hasSkill(sk__xiejia.name) and data.to ~= player and data.card and
      (data.card.trueName == "slash" or data.card.trueName == "duel") and player.room.logic:damageByCardEffect(true) and
      (#player:getEquipments(Card.SubtypeArmor) == 0 or player:getMark(sk__xiejia.name) > 0)
  end,
  on_use = function(self, event, target, player, data)
    if #player:getEquipments(Card.SubtypeArmor) == 0 then
      data.damage = data.damage + 1
    end
    data.damage = data.damage + player:getMark(sk__xiejia.name)
  end,
})
sk__xiejia:addEffect(fk.AfterCardsMove, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(sk__xiejia.name)
  end,
  on_refresh = function(self, event, target, player, data)
    for _, move in ipairs(data) do
      if move.from == player then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerEquip then
            if Fk:getCardById(info.cardId).sub_type == Card.SubtypeArmor then
              player.room:addPlayerMark(player, sk__xiejia.name, 1)
            end
          end
        end
      end
    end
  end,
})

return sk__xiejia